import { PlusOutlined } from '@ant-design/icons';
import { Button, Checkbox, Form, Input, Upload } from 'antd';
import TextArea from 'antd/es/input/TextArea';
import { history } from 'umi';
import React, { useEffect } from 'react';

export default function HouseType() {
  console.log(history);
  const [form] = Form.useForm();
  useEffect(() => {
    form.setFieldsValue({
      names: history.location.state?.title,
    });
  }, []);
  return (
    <div>
      <Form
        name="basic"
        labelCol={{ span: 8 }}
        wrapperCol={{ span: 16 }}
        style={{ maxWidth: 600 }}
        initialValues={{ remember: true }}
        // onFinish={onFinish}
        // onFinishFailed={onFinishFailed}
        autoComplete="off"
      >
        <Form.Item
          label="所属楼盘"
          name="username"
          rules={[{ required: true, message: 'Please input your username!' }]}
        >
          <span>{history.location.state?.developer_name}</span>
        </Form.Item>
        <Form.Item
          label="户型名称"
          name="names"
          rules={[{ required: true, message: 'Please input your username!' }]}
        >
          <Input />
        </Form.Item>

        <Form.Item
          label="房型"
          name="type"
          rules={[{ required: true, message: 'Please input your username!' }]}
        >
          <Input />室<Input />厅<Input />卫<Input />厨
        </Form.Item>

        <Form.Item
          label="面积"
          name="username"
          rules={[{ required: true, message: 'Please input your username!' }]}
        >
          <Input />
          m²
          <Input />万
        </Form.Item>

        <Form.Item
          label="户型特色"
          name="username"
          rules={[{ required: true, message: 'Please input your username!' }]}
        ></Form.Item>

        <Form.Item label="户型特色">
          <TextArea rows={4} />
        </Form.Item>

        <Form.Item label="户型图" valuePropName="fileList">
          <Upload action="/upload.do" listType="picture-card">
            <div>
              <PlusOutlined />
              <div style={{ marginTop: 8 }}>Upload</div>
            </div>
          </Upload>
        </Form.Item>

        <Form.Item wrapperCol={{ offset: 8, span: 16 }}>
          <Button type="primary" htmlType="submit">
            提交
          </Button>
        </Form.Item>
      </Form>
    </div>
  );
}
